/*
 * @Descripttion: 
 * @version: 
 * @Author: sueRimn
 * @Date: 2019-06-06 17:21:43
 * @LastEditors  : sueRimn
 * @LastEditTime : 2020-01-06 21:02:56
 */
import {getHandleLog, getSystemLog, getWaringData, dealWarn, warnSetDetail, saveWarnSet} from '@/api/logApi'
const log = {
    namespaced: true,
    state: {},
    getters: {},
    mutations: {},
    actions: {
        // 获取操作日志信息
        GetHandleLog ({state, commit, dispatch}, params) {
            return new Promise((resolve, reject) => {
                getHandleLog(params).then(res => {
                    // console.log(res)
                    // if (res.success) {
                    //     resolve(res)   
                    // }
                    resolve(res)   
                }).catch(error => {
                    reject(error)
                })
            })
        },
        // 获取系统日志信息
        GetSystemLog ({state, commit, dispatch}, params) {
            return new Promise((resolve, reject) => {
                getSystemLog(params).then(res => {
                    // console.log(res)
                    // if (res.success) {
                    //     resolve(res)   
                    // }
                    resolve(res)   
                }).catch(error => {
                    reject(error)
                })
            })
        },
        // 获取告警详情
        GetWaringData ({state, commit, dispatch}, params) {
            return new Promise((resolve, reject) => {
                getWaringData(params).then(res => {
                    // console.log(res)
                    // if (res.success) {
                    //     resolve(res)   
                    // }
                    resolve(res)   
                }).catch(error => {
                    reject(error)
                })
            })
        },
        // 告警事件处理
        DealWarn ({state, commit, dispatch}, params) {
            return new Promise((resolve, reject) => {
                dealWarn(params).then(res => {
                    // console.log(res)
                    // if (res.success) {
                    //     resolve(res)   
                    // }
                    resolve(res)   
                }).catch(error => {
                    reject(error)
                })
            })
        },
        // 告警设置详情
        WarnSetDetail ({state, commit, dispatch}, params) {
            return new Promise((resolve, reject) => {
                warnSetDetail(params).then(res => {
                    resolve(res)   
                }).catch(error => {
                    reject(error)
                })
            })
        },
        // 保存告警设置
        SaveWarnSet ({state, commit, dispatch}, params) {
            return new Promise((resolve, reject) => {
                saveWarnSet(params).then(res => {
                    resolve(res)   
                }).catch(error => {
                    reject(error)
                })
            })
        }
    }
}
export default log
